<?php
/**
 * Created by 项目.
 * User: xuguopeng
 * Date: 2019-12-31
 * Time: 10:38
 */

namespace app\api\controller\v1;


use app\api\controller\BaseController;
use app\api\model\UserInvitation;
use app\api\model\UserInvitationMoney;
use app\api\service\Token;
use app\api\service\invite\InviteSer;

class Invite extends BaseController
{
    /**
     * 获取用户关注量等信息
     */
    public function getInvite()
    {
        $uid = Token::getCurrentUid();
        return UserInvitation::with('invite')->where('inviter_id','=',$uid)->select()->toArray();
    }


    /**
     * 获取用户的分享二维码
     */
    public function setInviteImg()
    {
        $inviteSer = new InviteSer();
        return $inviteSer->getInviteImg();
    }


    /**
     * 获取用户分享金额
     */
    public function getInviteMoney()
    {
        $uid = Token::getCurrentUid();
        return UserInvitationMoney::with('user.member')->where('user_id',$uid)->select()->toArray();
    }
}